#include <pthread.h>
#include <stdio.h>
int sum = 0;
void* thread(void* arg) {  // 添加参数和返回值
    int i;
    for (i = 0; i < 1000000; i++)
        sum += 1;
    return NULL;
}
int main() {
    pthread_t tid1, tid2;
    pthread_create(&tid1, NULL, thread, NULL);
    pthread_create(&tid2, NULL, thread, NULL);
    pthread_join(tid1, NULL);
    pthread_join(tid2, NULL);
    printf("1i000000 + 1000000 = % d\n", sum);
    return (0);
}
